fix(feature_flags): warn on comparator evaluation errors - #8470
leandrodamascena merged 3 commits into
Conversation
|
Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need. |
|
This implements only the warning-only first step of #8425; the proposed major-version exception behavior remains open. The related-issue check currently requires a development link or a closing keyword. Could a maintainer link #8425 manually (or advise the preferred tracking issue for this first step)? I have avoided a closing keyword so merging this PR does not inadvertently close the remaining major-version work. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #8470 +/- ##
========================================
Coverage 96.80% 96.80%
========================================
Files 310 310
Lines 15534 15541 +7
Branches 1353 1354 +1
========================================
+ Hits 15037 15044 +7
Misses 361 361
Partials 136 136 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
leandrodamascena
left a comment
There was a problem hiding this comment.
Good catch, @Shubham-Padkonde, and thanks for working on this! I pushed a follow-up to your branch after finding that the default package logger was still swallowing the warning. It now uses warnings.warn(), with protection for -W error so evaluation and registered handlers keep working.
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
|
Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience! |
|
Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience! |



Issue number: closes #8425
This covers step 1 of #8425 (warning-only). Step 2, a dedicated exception in the next major version, is still open, so please reopen the issue or split it out if you want to track that separately.
Summary
Changes
Emit a warning when a feature-flag comparator raises while evaluating a present context key. Include the feature, rule, key, action, and exception type, without exposing operand values or exception messages. Pass that diagnostic context through the private comparator helper and document the warning.
User experience
Incompatible operands, such as
STARTSWITHon an integer, currently look like ordinary non-matches unless debug logging is enabled. They now produce an actionable warning. Existing non-match results and registered exception handlers are preserved; missing keys and valid non-matches stay quiet.This implements the first step proposed in the issue. Introducing a new exception remains a separate major-version decision. The tested approach was described in the issue before submission.
Validation:
make prstops at its Docker-based documentation command because Docker/WSL integration is unavailable here. Running markdownlint directly passes the edited page; the full docs check reports the pre-existingMD053error in unchangeddocs/changelog.md:1. The remaining check categories were run separately as listed above. AWS end-to-end and Redis integration tests were not run.Prepared with OpenAI Codex assistance.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.